<template>
    <div class="GrandChild">
        <h3>孙组件</h3>
        <h3>存款：{{ money }}</h3>
        <h3>车的品牌{{ car.brand }}，车的价格{{ car.price }}</h3>
        <button @click="updateMoney(6)">点击减少父组件存款</button>
    </div>
</template>

<script lang="ts" setup name="GrandChild">
    import { inject } from "vue";
    //数据

    let {money,updateMoney} = inject('money',{money:0,updateMoney:(param:number)=>{}})  //','后是默认值
    let car = inject('car',{brand:'默认',price:0})
</script>

<style scoped>
    .GrandChild{
        background-color: green;
        width: 1000px;
        height: 200px;
    }
</style>